class CreateEvents < ActiveRecord::Migration
  def self.up
    create_table :events, :primary_key=>"event_id" do |table|
      table.column :event_title, :string, :null => false
      table.column :event_type_id, :integer, :null => false # FK eventtypes
      table.column :parent_event_id, :integer # FK events
      table.column :created_at, :date, :null => false
    end
#    execute "
#      ALTER TABLE events ADD FOREIGN KEY (event_type_id) REFERENCES event_types (event_type_id);
#      ALTER TABLE events ADD FOREIGN KEY (parent_event_id) REFERENCES events (event_id);           
#    "     
  end

  def self.down
    drop_table :events
  end
end
